

class Home3 {

    // 2. 鼠标移入到”第一组“，”第二组“ 组标题上的时候， 当前组的所有学生li 背景改为 "#5ea6ee" 字体颜色为白色加粗。
    // ()=>{} 
    public h3AllEl = document.querySelectorAll('h3') as NodeListOf<HTMLHeadingElement>


    addEventListener() {
        this.h3AllEl.forEach(element => {
            element.addEventListener('mouseenter', (e) => {
                const et = e.target as Element
                let liAll = (et.closest('.group') as HTMLElement).querySelectorAll('li')
                liAll.forEach(element => {
                    element.classList.add('active')
                });

            })
        });

        this.h3AllEl.forEach(element => {
            element.addEventListener('mouseleave', (e) => {
                const et = e.target as Element
                let liAll = (et.closest('.group') as HTMLElement).querySelectorAll('li')
                liAll.forEach(element => {
                    element.classList.remove('active')
                });

            })
        });

    }



}

export default Home3